package com.changfen.fallback;

import com.changfen.UserProvider;
import com.changfen.domain.Student;
import com.changfen.domain.User;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author changfeng.chen
 * @date 2021/5/13
 * Email: changfeng.chen@things-matrix.com
 */
@Slf4j
@Component
public class UserProviderFallbackFactory implements FallbackFactory<UserProvider> {
    @Override
    public UserProvider create(Throwable throwable) {
        return new UserProvider() {
            @Override
            public List<User> findAll() {
                log.error("can get data");
                return null;
            }

            @Override
            public User findById(String id) {
                return null;
            }

            @Override
            public User userAndStudent(Student student, User user) {
                return null;
            }

        };
    }
}
